//
//  OffLineTableViewCell.m
//  MaskMachine
//
//  Created by yuanyuan on 15-3-6.
//  Copyright (c) 2015年 hanjiaxue. All rights reserved.
//

#import "OffLineTableViewCell.h"
#import "InterFace.h"
#import "UIViewAdditions.h"
@implementation OffLineTableViewCell

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        // Initialization code
        
        [self createrOffLineUI:CGRectMake(self.serialNumber.left, 0, 1, 30)];
        
        self.serialNumber = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 0.15625*SCREEN_WIDTH, 30)];
        self.serialNumber.textAlignment = NSTextAlignmentCenter;
        [self addSubview:self.serialNumber];
        self.serialNumber.font = [UIFont systemFontOfSize:12];
        [self createrOffLineUI:CGRectMake(self.serialNumber.left, 29, SCREEN_WIDTH-10, 1)];
        
        [self createrOffLineUI:CGRectMake(self.serialNumber.right, 0, 1, 30)];
        
        self.theAgent = [[UILabel alloc] initWithFrame:CGRectMake(_serialNumber.right, 0,  0.375*SCREEN_WIDTH, 30)];
        self.theAgent.textAlignment = NSTextAlignmentCenter;
        self.theAgent.font = [UIFont systemFontOfSize:12];
        [self addSubview:_theAgent];
        
        [self createrOffLineUI:CGRectMake(self.theAgent.right, 0, 1,30)];
        
        self.phoneNumber = [[UILabel alloc] initWithFrame:CGRectMake(self.theAgent.right, 0,  0.1875*SCREEN_WIDTH, 30)];
        self.phoneNumber.textAlignment = NSTextAlignmentCenter;
        self.phoneNumber.font = [UIFont systemFontOfSize:12];
        [self addSubview:self.phoneNumber];
        
        [self createrOffLineUI:CGRectMake(self.phoneNumber.right, 0, 1,30)];
        
        if (SCREEN_WIDTH == 320) {
            self.orderAmount = [[UILabel alloc] initWithFrame:CGRectMake(_phoneNumber.right, 0,  0.21875*SCREEN_WIDTH,30)];
            
        }else if (SCREEN_WIDTH == 375){
            self.orderAmount = [[UILabel alloc] initWithFrame:CGRectMake(_phoneNumber.right, 0,  0.22575*SCREEN_WIDTH,30)];
        }else{
            self.orderAmount = [[UILabel alloc] initWithFrame:CGRectMake(_phoneNumber.right, 0,  0.232*SCREEN_WIDTH,30)];
        }
        self.orderAmount.textAlignment = NSTextAlignmentCenter;
        self.orderAmount.font = [UIFont systemFontOfSize:12];
        [self addSubview:_orderAmount];
        
        [self createrOffLineUI:CGRectMake(self.orderAmount.right, 0, 1, 30)];
        
        [self createrOffLineUI:CGRectMake(self.phoneNumber.right, 0, 1,30)];
        
        if (SCREEN_WIDTH == 320) {
            self.state = [[UILabel alloc] initWithFrame:CGRectMake(self.orderAmount.right, 0, 0.1875*SCREEN_WIDTH, 30)];
        }else if (SCREEN_WIDTH == 375){
            self.state = [[UILabel alloc] initWithFrame:CGRectMake(self.orderAmount.right, 0, 0.1945*SCREEN_WIDTH, 30)];
        }else{
            self.state = [[UILabel alloc] initWithFrame:CGRectMake(self.orderAmount.right, 0, 0.201*SCREEN_WIDTH, 30)];
        }
        
        self.state.font = [UIFont systemFontOfSize:12];
        self.state.textAlignment = NSTextAlignmentCenter;
        [self addSubview:self.state];
        NSLog(@"%2f",self.state.right);
        [self createrOffLineUI:CGRectMake(self.state.right, 0, 1, 30)];
        
        //        UIView *line = [[UIView alloc] initWithFrame:CGRectMake(0, self.frame.size.height-1, self.frame.size.width, 1)];
        //        line.backgroundColor = [UIColor grayColor];
        //        line.alpha = 0.4;
        //        [self addSubview:line];
        //        [line release];
        
    }
    return self;
}

-(void)createrOffLineUI:(CGRect)rect{
    UIView *lines = [[UIView alloc] initWithFrame:rect];
    lines.backgroundColor = [UIColor colorWithRed:179/255.0 green:179/255.0 blue:179/255.0 alpha:1];
    [self addSubview:lines];
}

- (void)awakeFromNib
{
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated
{
    [super setSelected:selected animated:animated];
    
    // Configure the view for the selected state
}

@end
